Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new feature SASL SCRAM #1706

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Oct 20, 2024

Found by:
Patch by: michaelortmann
Fixes:

One-line summary:

Additional description (if needed):
This PR implements SASL_MECHANISM_SCRAM_SHA_256 and SASL_MECHANISM_SCRAM_SHA_512
State machine for sasl scram
Add Tcl_TraceVar() for sasl-mechanism
Cache client and server key for sasl scram
Modularized sasl stuff into sasl.c / Refactor
Updated doc
Set sasl-username to username, if not set
Enhance logging
Leave got900() in servmsg.c instead of sasl.c
Constant time memory comparison
Update valid cap sasl mechanism list on server 908
Handle SASL AUTHENTICATE server error
pre sasl mechanism ECDH-X25519-CHALLENGE

Checks 3 boxes in #832:
#688 (comment) - grawity proposed replacing sasl state processing with real state keeping.
Implement scram authentication
Handle 908 messages

Test cases demonstrating functionality (if applicable):

set sasl 1
set sasl-mechanism 4
[...]
[09:25:49] SASL: Starting authentication process
[09:25:49] SASL: AUTHENTICATE SCRAM-SHA-512
[...]
[09:25:50] SASL: authentication of server successful
[09:25:50] [m->] AUTHENTICATE +
[09:25:51] [@] :zen.home.arpa 900 BotA BotA!BotA@localhost BotA :You are now logged in as BotA
[09:25:51] zen.home.arpa: You are now logged in as BotA
[09:25:52] [@] :zen.home.arpa 903 BotA :SASL authentication successful
[09:25:52] SASL: SASL authentication successful

State machine for sasl scram
Add Tcl_TraceVar() for sasl-mechanism
Modularized sasl stuff into sasl.c / Refactor
Updated doc
Set sasl-username to username, if not set
Enhance logging
Leave got900() in servmsg.c instead of sasl.c
Constant time memory comparison
Update valid cap sasl mechanism list on server 908
Handle SASL AUTHENTICATE server error
pre sasl mechanism ECDH-X25519-CHALLENGE
@michaelortmann michaelortmann mentioned this pull request Dec 19, 2024
9 tasks
@michaelortmann michaelortmann changed the title (WIP) SASL SCRAM SASL SCRAM Dec 19, 2024
@michaelortmann
Copy link
Member Author

Ready for review :)

@michaelortmann michaelortmann changed the title SASL SCRAM Add new feature SASL SCRAM Jan 8, 2025
@vanosg vanosg added this to the v1.10.1 milestone Jan 12, 2025
@eggheads eggheads deleted a comment from Neustradamus Jan 12, 2025
src/mod/server.mod/sasl.c Show resolved Hide resolved
/* RFC 5802 - printable ASCII characters excluding ','
* printable = %x21-2B / %x2D-7E
*/
#define CHARSET_SCRAM "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this into server.h?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but i think sasl.c is a better place for this, for its only related to sasl. similar to the defines and enums that follow. But we could move it into function sasl_scram_step_0().

@Neustradamus
Copy link

Why my previous comment has been removed?


Dear @eggheads team, @michaelortmann,

I have discovered this PR by chance, nice to see this SCRAM improvement!

Linked to:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants